package com.example.project.controller;

import com.example.project.vo.model.PageDto;
import com.example.project.aop.ResponseResult;
import com.example.project.entity.ConFiles;
import com.example.project.service.ConFilesService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import io.swagger.annotations.ApiOperation;

import java.util.List;

/**
 * (ConFiles)表控制层
 */
@Api(tags = "ConFiles模块")
@ResponseResult
@RequestMapping("conFiles")
public class ConFilesController {

    public static final String modelName = "ConFiles";
    /**
     * 服务对象
     */
    @Resource
    private ConFilesService conFilesService;

    @ApiOperation("分页查询查询 " + modelName)
    @PostMapping("/page")
    public PageInfo<ConFiles> queryAll(@RequestBody PageDto pageDto) {
        return this.conFilesService.queryAll(pageDto);
    }

    @ApiOperation(modelName + " list查询")
    @GetMapping("/list")
    public List<ConFiles> querryList() {
        return this.conFilesService.querryList();
    }

    @ApiOperation("通过主键查询单条 " + modelName + " 数据")
    @GetMapping("/detail")
    public ConFiles queryById(@RequestParam("id") Long id) {
        return this.conFilesService.queryById(id);
    }

    @ApiOperation("新增 " + modelName + " 数据")
    @PostMapping("/save")
    public ConFiles add(@RequestBody ConFiles conFiles) {
        return this.conFilesService.insert(conFiles);
    }

    @ApiOperation("编辑 " + modelName + " 数据")
    @PostMapping("/updateById")
    public ConFiles edit(@RequestBody ConFiles conFiles) {
        return this.conFilesService.update(conFiles);
    }

    @ApiOperation("通过id 删除 " + modelName + " 数据")
    @DeleteMapping("/delete")
    public Boolean deleteById(@RequestParam("id") Long id) {
        return this.conFilesService.deleteById(id);
    }

}

